(function(m){m.CeraBox=new Class({version:"1.3.8",Implements:[Options],boxWindow:null,collection:[],currentItem:0,options:{ajax:null,swf:null,group:!0,width:null,height:null,displayTitle:!0,fullSize:!1,displayOverlay:!0,clickToClose:!1,loaderAtItem:!1,animation:"fade",errorLoadingMessage:"The requested content cannot be loaded or might not be supported. Please try again later.",titleFormat:"Item {number} / {total} {title}",addContentProtectionLayer:!1,mobileView:"ios"==Browser.platform||"android"==
Browser.platform||"webos"==Browser.platform,fixedPosition:!1,clickToCloseOverlay:!0,constrainProportions:!1,devicePixelRatio:void 0!==m.devicePixelRatio?m.devicePixelRatio:1,preventScrolling:!1,events:{onOpen:function(a,c){},onChange:function(a,c){},onClose:function(a,c){},onAnimationEnd:function(a,c){}}},initialize:function(a,c){this.boxWindow=CeraBoxWindow;a=$$(a);c&&"null"!=typeOf(c.group)&&!1===c.group&&1<a.length&&a.each(function(a){a.store("cerabox",new CeraBox(a,c))});this.setOptions(c);a.each(function(a,
c){this.collection[c]=a;var h=a.dataset?"string"==typeOf(a.dataset.type)&&""!=a.dataset.type.trim()?a.dataset.type.trim():null:a.get("data-type")&&""!=a.get("data-type").trim()?a.get("data-type").trim():null;if(null!==this.options.ajax&&null===h||"ajax"==h)a.addEvent("click",function(a){return this._itemClick(a)?(this.currentItem=c,this.showAjax(),!0):!1}.bind(this));else if(a.get("href").test(/^#/i)&&null===h||"inline"==h)a.addEvent("click",function(a){return this._itemClick(a)?(this.currentItem=
c,this.showInline(),!0):!1}.bind(this));else if(a.get("href").test(/\.(jpg|jpeg|png|gif|bmp)(.*)?$/i)&&null===h||"image"==h)a.addEvent("click",function(a){return this._itemClick(a)?(this.currentItem=c,this.showImage(),!0):!1}.bind(this));else if(a.get("href").test(/\.(swf)(.*)?$/i)&&null===h||"swf"==h)a.addEvent("click",function(a){return this._itemClick(a)?(this.currentItem=c,this.showSwf(),!0):!1}.bind(this));else{if(null!==h&&"iframe"!=h)throw"Unknown type in dataset: "+h;a.addEvent("click",function(a){return this._itemClick(a)?
(this.currentItem=c,this.showIframe(),!0):!1}.bind(this))}}.bind(this))},showAjax:function(){var a=this,c=a.collection[a.currentItem];(new Request.HTML(Object.merge({url:c.get("href"),method:"post",data:"",evalScripts:!1,onSuccess:function(g,b,h,D){if(!1!==a.boxWindow.getBusy()){var p=[];Array.each(b,function(a){"img"==a.get("tag")&&a.get("src")&&p.append([a.get("src")])});b=function(){var b=a.boxWindow.preLoadElement(g);!0!==a.options.constrainProportions||a.options.width&&a.options.height||!a.options.width&&
!a.options.height?(b.setStyle("width",a.options.width?a.options.width:b.getScrollSize().x),b.setStyle("height",a.options.height?a.options.height:b.getScrollSize().y)):a.options.width?(b.set("height",Math.round(b.getScrollSize().y*(a.boxWindow.sizeStringToInt(a.options.width,"x")/b.getScrollSize().x))),b.set("width",a.options.width)):(b.set("width",Math.round(b.getScrollSize().x*(a.boxWindow.sizeStringToInt(a.options.height,"y")/b.getScrollSize().y))),b.set("height",a.options.height));var h=a.boxWindow.getSizeElement(b),
b=b.get("html");a.boxWindow.onLoad(h.width,h.height).addEvent("complete",function(){this.removeEvents("complete");!1!==a.boxWindow.getBusy()&&(!1!==a.options.displayTitle&&a.boxWindow.displayTitle(c.get("title")?c.get("title"):"",a.currentItem+1,a.collection.length),a.boxWindow.setContent(new Element("div",{html:b})).openWindow(),function(){eval(D)}.call(a))})};p.length?Asset.images(p,{onComplete:b}):b()}},onerror:a._timedOut.bind(a),onTimeout:a._timedOut.bind(a),onFailure:a._timedOut.bind(a),onException:a._timedOut.bind(a)},
"object"===typeOf(a.options.ajax)?a.options.ajax:{}))).send()},showInline:function(){var a=this,c=a.collection[a.currentItem],g=c.get("href").test(/^#\$/i)&&"null"!=typeOf(m[c.get("href").replace(/^#\$/i,"")])?"element"!=typeOf(m[c.get("href").replace(/^#\$/i,"")])?new Element("div",{html:m[c.get("href").replace(/^#\$/i,"")]}):m[c.get("href").replace(/^#\$/i,"")]:document.id(document.body).getElement(c.get("href"))?document.id(document.body).getElement(c.get("href")).clone():null;if(null!==g){var b=
[];Array.each(g.getElements("img"),function(a){a.get("src")&&b.append([a.get("src")])});var h=function(){var b=a.boxWindow.preLoadElement(g.clone());!0!==a.options.constrainProportions||a.options.width&&a.options.height||!a.options.width&&!a.options.height?(b.setStyle("width",a.options.width?a.options.width:b.getScrollSize().x),b.setStyle("height",a.options.height?a.options.height:b.getSize().y)):a.options.width?(b.set("height",Math.round(b.getSize().y*(a.boxWindow.sizeStringToInt(a.options.width,
"x")/b.getScrollSize().x))),b.set("width",a.options.width)):(b.set("width",Math.round(b.getScrollSize().x*(a.boxWindow.sizeStringToInt(a.options.height,"y")/b.getSize().y))),b.set("height",a.options.height));b=a.boxWindow.getSizeElement(b);a.boxWindow.onLoad(b.width,b.height).addEvent("complete",function(){this.removeEvents("complete");!1!==a.boxWindow.getBusy()&&(!1!==a.options.displayTitle&&a.boxWindow.displayTitle(c.get("title")?c.get("title"):"",a.currentItem+1,a.collection.length),a.boxWindow.setContent(g).openWindow())})};
b.length?Asset.images(b,{onComplete:h}):h()}else a._timedOut()},showImage:function(){var a=this,c=a.collection[a.currentItem],g=new Asset.image(c.get("href"),{"class":"ceraImage",onload:function(){if(!1!==a.boxWindow.getBusy()){!0!==a.options.constrainProportions||a.options.width&&a.options.height||!a.options.width&&!a.options.height?(this.set("width",a.options.width?a.options.width:this.get("width")),this.set("height",a.options.height?a.options.height:this.get("height"))):a.options.width?(this.set("height",
Math.round(this.get("height").toInt()*(a.boxWindow.sizeStringToInt(a.options.width,"x")/this.get("width")))),this.set("width",a.options.width)):(this.set("width",Math.round(this.get("width").toInt()*(a.boxWindow.sizeStringToInt(a.options.height,"y")/this.get("height")))),this.set("height",a.options.height));var b=a.boxWindow.getSizeElement(this);1<a.options.devicePixelRatio&&(b={width:b.width/a.options.devicePixelRatio,height:b.height/a.options.devicePixelRatio});a.boxWindow.onLoad(b.width,b.height).addEvent("complete",
function(){this.removeEvents("complete");!1!==a.boxWindow.getBusy()&&(!1!==a.options.displayTitle&&a.boxWindow.displayTitle(c.get("title")?c.get("title"):"",a.currentItem+1,a.collection.length),a.boxWindow.setContent(g).openWindow())})}},onerror:a._timedOut.bind(a)})},showSwf:function(){if(0==Browser.Plugins.Flash.version)this._timedOut();else{var a=this,c=a.collection[a.currentItem],g=a.options.width?a.options.width:500,b=a.options.height?a.options.height:400,h=new Swiff(c.get("href"),Object.merge({width:g,
height:b,params:{wMode:"opaque",base:/(.*)\/.+(\.swf).*/.exec(c.get("href"))[1]}},"object"===typeOf(a.options.swf)?a.options.swf:{}));a.boxWindow.onLoad(g,b).addEvent("complete",function(){this.removeEvents("complete");!1!==a.boxWindow.getBusy()&&(!1!==a.options.displayTitle&&a.boxWindow.displayTitle(c.get("title")?c.get("title"):"",a.currentItem+1,a.collection.length),a.boxWindow.setContent(h).openWindow())})}},showIframe:function(){this.boxWindow.setTimeOuter(this._timedOut.delay(1E4,this));var a=
this,c=new IFrame({src:a.collection[a.currentItem].get("href"),"class":"ceraIframe",styles:{width:1,height:1,border:"0px"},events:{load:function(){if(!1!==a.boxWindow.getBusy()||a.boxWindow.getWindowOpen()){if(!a.options.width&&!a.options.height)try{!Browser.ie||8<Browser.version?this.contentWindow.onbeforeunload=function(){a.boxWindow.loading(a);this.setStyles({width:"1px",height:"1px"})}.bind(this):this.setStyles({width:"1px",height:"1px"})}catch(c){}a.options.width&&this.setStyle("width",a.options.width);
a.options.height&&this.setStyle("height",a.options.height);var b=a.boxWindow.getSizeElement(this);a.boxWindow.onLoad(b.width,b.height).addEvent("complete",function(){this.removeEvents("complete");(!1!==a.boxWindow.getBusy()||a.boxWindow.getWindowOpen())&&a.boxWindow.openWindow()})}}}});c.set("border",0);c.set("frameborder",0);this.boxWindow.setContent(c)},_timedOut:function(){var a=this,c=new Element("span",{"class":"cerabox-error",html:a.options.errorLoadingMessage}),g=a.boxWindow.preLoadElement(c.clone());
g.setStyle("width","270px");g.setStyle("height",g.getSize().y+"px");this.options.mobileView&&c.setStyles({position:"absolute",top:"50%","margin-top":-Math.round(g.getSize().y/2)+"px"});g=a.boxWindow.getSizeElement(g,!0);a.boxWindow.onLoad(g.width,g.height).addEvent("complete",function(){this.removeEvents("complete");!1!==a.boxWindow.getBusy()&&(a.boxWindow.hideTitle(),a.boxWindow.setContent(c).openWindow())})},_itemClick:function(a){a&&a.preventDefault();if(this.boxWindow.getBusy())return!1;this.boxWindow.loading(this);
return!0},_log:function(a,c){try{console.log(a)}catch(g){c&&alert(a)}}});m.CeraBoxWindow=function(a){function c(){e.getElement(".cerabox-left").removeEvents("click").setStyle("display","none");e.getElement(".cerabox-right").removeEvents("click").setStyle("display","none");d.collection[d.currentItem-1]&&e.getElement(".cerabox-left").setStyle("display","block").addEvent("click",function(a){a.stopPropagation();l||(this.setStyle("display","none").removeEvents("click"),d.collection[d.currentItem-1].fireEvent("click",
a))});d.collection[d.currentItem+1]&&e.getElement(".cerabox-right").setStyle("display","block").addEvent("click",function(a){a.stopPropagation();l||(this.setStyle("display","none").removeEvents("click"),d.collection[d.currentItem+1].fireEvent("click",a))})}function g(k,n){k=k||s.x;n=n||s.y;d.options.displayTitle&&!e.getElement(".cerabox-content iframe.ceraIframe")||t.hideTitle();if(d.options.mobileView){document.id(document.body).setStyle("overflow","hidden");var b=90==Math.abs(a.orientation)?screen.height:
screen.width,c,g,h,l;e.getElement(".cerabox-content iframe.ceraIframe")?(c=f.x,g=f.y,h=g<n*c/k?g/n:c/k,l=1,e.getElements(".cerabox-close, .cerabox-left, .cerabox-right, .cerabox-title").setStyles({"-webkit-transform":"scale("+f.x/b+")",transform:"scale("+f.x/b+")"})):(e.getElement(".cerabox-content img.ceraImage")||(k=Math.round(f.x*(b/f.x)),n=Math.round(f.y*(b/f.x))),c=Math.round(f.x*(b/f.x)),g=Math.round(f.y*(b/f.x)),h=g<n*c/k?g/n:c/k,l=f.x/b,e.getElements(".cerabox-close, .cerabox-left, .cerabox-right, .cerabox-title").setStyles({"-webkit-transform":"scale(1)",
transform:"scale(1)"}));e.setStyles({position:"absolute",display:"block",width:c+"px",height:g+"px",opacity:1,left:document.id(document.body).getScroll().x,right:0,top:document.id(document.body).getScroll().y,bottom:0,margin:0,"-webkit-transform":"scale("+l+")",transform:"scale("+l+")"});e.getElement(".cerabox-content").setStyles({width:Math.round(k*h),height:Math.round(n*h),left:(c-Math.round(k*h))/2,top:(g-Math.round(n*h))/2});e.getElement(".cerabox-content iframe.ceraIframe")&&e.getElement(".cerabox-content iframe.ceraIframe").setStyles({width:Math.round(k*
h),height:Math.round(n*h)});return e.set("tween",{duration:0}).tween("opacity",1).get("tween")}e.getElement(".cerabox-content iframe.ceraIframe")&&e.getElement(".cerabox-content iframe.ceraIframe").setStyles({width:k,height:n});b={display:"block",width:k,height:n,opacity:1,"-webkit-transform":"scale(1)",transform:"scale(1)"};e.setStyles({position:d.options.fixedPosition?"fixed":"absolute",top:Math.round(f.y/2)+"px",left:Math.round(f.x/2)+"px",right:"auto",bottom:"auto"});b["margin-left"]=f.x>k+60?
Math.round(-k/2+(d.options.fixedPosition?0:document.id(document.body).getScroll().x))+"px":Math.round(f.x/2-k-40+(d.options.fixedPosition?0:document.id(document.body).getScroll().x))+"px";b["margin-top"]=f.y>n+40?Math.round(-n/2+(d.options.fixedPosition?0:document.id(document.body).getScroll().y))+"px":Math.round(-f.y/2+20+(d.options.fixedPosition?0:document.id(document.body).getScroll().y))+"px";e.getElement(".cerabox-content").setStyles({width:"100%",height:"100%",left:0,top:0});if(q)return e.set("morph",
{duration:150}).morph(b).get("morph");switch(d.options.animation){case "ease":return c=d.collection[d.currentItem],Object.append(b,{top:e.getStyle("top"),left:e.getStyle("left")}),e.setStyles({display:"block",left:c.getPosition().x-(d.options.fixedPosition?document.id(document.body).getScroll().x:0)+"px",top:c.getPosition().y-(d.options.fixedPosition?document.id(document.body).getScroll().y:0)+"px",width:c.getSize().x+"px",height:c.getSize().y+"px",margin:0,opacity:0}).set("morph",{duration:200}).morph(b).get("morph");
default:return Object.append(b,{opacity:0}),e.setStyles(b).set("tween",{duration:200}).tween("opacity",1).get("tween")}}function b(){var a={display:"block",opacity:d.options.mobileView?1:0.5,top:0,left:0,height:"100%",width:"100%",position:"fixed"};d.options.mobileView&&Object.merge(a,{top:0,left:0,width:document.id(document.body).getScrollSize().x+"px",height:document.id(document.body).getScrollSize().y+"px",position:"absolute"});document.id("cerabox-background").setStyles(a)}function h(){var k=
{position:"fixed",display:"block",top:"50%",left:"50%","margin-top":"-20px","margin-left":"-20px","-webkit-transform":"scale(1)",transform:"scale(1)"};if(!0!==d.options.loaderAtItem||q)d.options.mobileView&&(b=90==Math.abs(a.orientation)?screen.height:screen.width,Object.append(k,{position:"absolute",top:Math.round(f.y/2-document.id("cerabox-loading").getStyle("height").toInt()/2+document.id(document.body).getScroll().y)+"px",left:Math.round(f.x/2-document.id("cerabox-loading").getStyle("width").toInt()/
2+document.id(document.body).getScroll().x)+"px","margin-top":0,"margin-left":0,"-webkit-transform":"scale("+f.x/b+")",transform:"scale("+f.x/b+")"}));else{var b=d.collection[d.currentItem];Object.append(k,{position:"absolute",top:Math.round(b.getSize().y/2-document.id("cerabox-loading").getStyle("height").toInt()/2+b.getPosition().y)+"px",left:Math.round(b.getSize().x/2-document.id("cerabox-loading").getStyle("width").toInt()/2+b.getPosition().x)+"px","margin-top":0,"margin-left":0})}document.id("cerabox-loading").setStyles(k);
m()}function m(a){a||(a=0);document.id("cerabox-loading").getElement("div").setStyle("top",-40*a+"px");a=(a+1)%12;"none"!=document.id("cerabox-loading").getStyle("display")&&m.delay(60,this,a)}function p(a,b){return"string"==typeOf(a)&&a.test("%")?f[b]*(a.toInt()/100):a.toInt()}function E(){var a=document.id(document.body);a.getElement("#cerabox")||a.adopt([(new Element("div",{id:"cerabox-loading"})).adopt(new Element("div")),new Element("div",{id:"cerabox-background",events:{click:function(a){a.stop();
d.options.clickToCloseOverlay&&t.close()}}}),e=(new Element("div",{id:"cerabox"})).adopt([new Element("div",{"class":"cerabox-content"}),(new Element("div",{"class":"cerabox-title"})).adopt(new Element("span")),new Element("a",{"class":"cerabox-close",events:{click:function(a){a.stop();t.close()}}}),(new Element("a",{"class":"cerabox-left"})).adopt(new Element("span")),(new Element("a",{"class":"cerabox-right"})).adopt(new Element("span")),new Element("div",{"class":"cerabox-content-protection"}),
new Element("div",{id:"cerabox-ajaxPreLoader",styles:{"float":"left",overflow:"hidden",display:"block"}})])])}function A(){clearInterval(w);e.getElements(".cerabox-title, .cerabox-close, .cerabox-left, .cerabox-right").set("tween",{duration:500}).tween("opacity",0)}function z(){e.getElements(".cerabox-title, .cerabox-close, .cerabox-left, .cerabox-right").setStyle("opacity",1);clearInterval(w);d.options.mobileView&&!d.options.clickToClose&&"createTouch"in document&&!e.getElement(".cerabox-content iframe.ceraIframe")&&
(w=A.delay(5E3))}function F(a){u=r=a.client}function G(a){r=a.client;a.preventDefault()}function H(k){if(null!==u.x&&null!==r.x){var b=Math.round(Math.sqrt(Math.pow(r.x-u.x,2)+Math.pow(r.y-u.y,2))),d=90==Math.abs(a.orientation)?screen.height:screen.width;50<=Math.round(b*(d/f.x))?(b=Math.round(180*Math.atan2(r.y-u.y,u.x-r.x)/Math.PI),0>b&&(b=360-Math.abs(b)),315<=b||45>=b?e.getElement(".cerabox-right").fireEvent("click",k):135<=b&&225>=b&&e.getElement(".cerabox-left").fireEvent("click",k)):b||"a"==
k.target.get("tag")||k.target.getParent(".cerabox-close")||k.target.getParent(".cerabox-left")||k.target.getParent(".cerabox-right")||(e.fireEvent("click",k),k.stop(),1!=e.getElement(".cerabox-close").getStyle("opacity")?z():A())}B()}function B(){u={x:null,y:null};r={x:null,y:null}}function C(a){a?(t.oldoverflow=document.getElement("body").getStyle("overflow"),document.getElement("body").setStyle("overflow","hidden")):document.getElement("body").setStyle("overflow",t.oldoverflow)}var l=!1,v=!1,x=
null,y=null,q=!1,d=null,s={x:0,y:0},w=null,u={x:null,y:null},r={x:null,y:null},f={x:0,y:0},e=null,t=new new Class({initialize:function(){a.addEvent("domready",function(){E();this.updateWindow();document.id("cerabox-loading").addEvent("click",function(a){a.stop();this.close(!0)}.bind(this));document.addEvent("keyup",function(a){"esc"==a.key&&this.close();"input"!=a.target.get("tag")&&"select"!=a.target.get("tag")&&"textarea"!=a.target.get("tag")&&("left"==a.key&&e.getElement(".cerabox-left").fireEvent("click",
a),"right"==a.key&&e.getElement(".cerabox-right").fireEvent("click",a))}.bind(this));e.addEvent("touchstart",F);e.addEvent("touchmove",G);e.addEvent("touchend",H);e.addEvent("touchcancel",B);document.id("cerabox-loading").addEvent("touchmove",function(a){a.stop()})}.bind(this));a.addEvent("resize",this.updateWindow.bind(this));a.addEvent("scroll",this.updateWindow.bind(this,"scroll"));a.addEvent("orientationchange",this.updateWindow.bind(this))},updateWindow:function(a){this.setViewport();!q||null===
d||l||"scroll"==a&&!d.options.mobileView||(l=!0,(!1!==d.options.displayOverlay||d.options.mobileView)&&b(),g().addEvent("complete",function(){this.removeEvents("complete");z();l=!1}))},close:function(a){l&&!a||v||!d||(l=!a,!0===d.options.preventScrolling&&C(!1),clearInterval(y),clearInterval(x),clearInterval(w),document.id("cerabox-loading").setStyle("display","none"),d.options.mobileView?(document.id("cerabox-background").setStyles({display:"none",width:0,height:0,opacity:0}),e.setStyles({display:"none"}),
e.getElement(".cerabox-content").empty().setStyle("opacity",0),e.getElement(".cerabox-left").removeEvents("click").setStyle("display","none"),e.getElement(".cerabox-right").removeEvents("click").setStyle("display","none"),this.hideTitle(),q&&d.options.events.onClose.call(d,d.collection[d.currentItem],d.collection),d=null,l=q=!1):e.set("tween",{duration:50}).tween("opacity",0).get("tween").addEvent("complete",function(){this.removeEvents("complete");document.id("cerabox-background").set("tween",{duration:50,
link:"chain"}).tween("opacity",0).get("tween").addEvent("chainComplete",function(){this.removeEvents("chainComplete");document.id("cerabox-background").setStyle("display","none");e.setStyles({display:"none"});e.getElement(".cerabox-content").empty().setStyle("opacity",0);e.getElement(".cerabox-left").removeEvents("click").setStyle("display","none");e.getElement(".cerabox-right").removeEvents("click").setStyle("display","none");t.hideTitle();q&&d.options.events.onClose.call(d,d.collection[d.currentItem],
d.collection);d=null;l=q=!1})}))},setContent:function(a){e.getElement(".cerabox-content").empty().adopt(a);return this},loading:function(a){if(!instanceOf(a,CeraBox))throw"Instance should be an instance of CeraBox";this.setViewport();d=a;l=!0;e.getElement(".cerabox-content-protection").setStyle("display","none");!0===d.options.addContentProtectionLayer&&e.getElement(".cerabox-content-protection").setStyle("display","block");e.setStyle("cursor","auto").removeEvents("click");!0===d.options.clickToClose&&
e.setStyle("cursor","pointer").addEvent("click",function(a){a.stop();this.close()}.bind(this));!0===d.options.preventScrolling&&C(!0);clearInterval(y);clearInterval(x);document.id("cerabox-loading").setStyle("display","none");x=h.delay(200);e.removeClass("mobile");d.options.mobileView&&e.addClass("mobile");return this},preLoadElement:function(a){e.setStyle("display","block");return e.getElement("#cerabox-ajaxPreLoader").empty().adopt(a)},onLoad:function(a,c){v=!0;clearInterval(y);clearInterval(x);
(!1!==d.options.displayOverlay||d.options.mobileView)&&b();e.getElement("#cerabox-ajaxPreLoader").empty().setStyles({width:"auto",height:"auto"});s={x:a,y:c};return e.getElement(".cerabox-content").set("tween",{duration:d.options.mobileView?0:300}).tween("opacity",q&&e.getElement(".cerabox-content iframe.ceraIframe")?1:0).get("tween")},openWindow:function(a,b){document.id("cerabox-loading").setStyle("display","none");a=s.x=a||s.x;b=s.y=b||s.y;var f=d.collection[d.currentItem];z();q?(g(a,b),d.options.mobileView?
(e.getElement(".cerabox-content").setStyle("opacity",1),l=v=!1,c(),d.options.events.onChange.call(d,f,d.collection)):e.getElement(".cerabox-content").set("tween",{duration:e.getElement(".cerabox-content iframe.ceraIframe")?0:200}).tween("opacity",1).get("tween").addEvent("complete",function(){this.removeEvents("complete");l=v=!1;c();d.options.events.onChange.call(d,f,d.collection)})):(d.options.mobileView||e.getElement(".cerabox-content").setStyle("opacity",1),d.options.events.onOpen.call(d,f,d.collection),
g(a,b).addEvent("complete",function(){this.removeEvents("complete");d.options.mobileView&&e.getElement(".cerabox-content").setStyle("opacity",1);l=v=!1;c();d.options.events.onAnimationEnd.call(d,f,d.collection)}),f.blur(),q=!0)},displayTitle:function(a,b,c){1<c&&(a=d.options.titleFormat.substitute({number:b,total:c,title:a}));b=e.getElement(".cerabox-title span");a?(b.setStyle("display","block").set("text",a),b.set("html",b.get("html").replace("\n","<br>"))):b.setStyle("display","none");return this},
hideTitle:function(){e.getElement(".cerabox-title span").setStyle("display","none");return this},setViewport:function(){f={x:a.innerWidth?a.innerWidth:a.getSize().x,y:a.innerHeight?a.innerHeight:a.getSize().y};return this},getViewport:function(){return f},getCurrentInstance:function(){return d},getBusy:function(){return l},getWindowOpen:function(){return q},setTimeOuter:function(a){y=a;return this},getSizeElement:function(a,b){var c=0,g=0;if("iframe"==a.get("tag")){e.setStyle("display","block");try{c=
a.get("width")?p(a.get("width"),"x"):1<a.getStyle("width").toInt()?p(a.getStyle("width"),"x"):a.contentWindow.document.getScrollSize().x?a.contentWindow.document.getScrollSize().x:0.75*f.x}catch(h){c=0.75*f.x}try{g=a.get("height")?p(a.get("height"),"y"):1<a.getStyle("height").toInt()?p(a.getStyle("height"),"y"):a.contentWindow.document.getScrollSize().y?a.contentWindow.document.getScrollSize().y:0.75*f.y}catch(l){g=0.75*f.y}10>c&&(c=0.75*f.x,g=0.75*f.y);if(b||!1!==d.options.fullSize)return{width:c,
height:g};f.y-100<g&&(c+=Browser.Platform.mac?15:17);return{width:f.x-50<c?f.x-50:c,height:f.y-100<g?f.y-100:g}}c=a.get("width")?p(a.get("width"),"x"):a.getStyle("width")&&"auto"!=a.getStyle("width")?p(a.getStyle("width"),"x"):f.x-50;g=a.get("height")?p(a.get("height"),"y"):a.getStyle("height")&&"auto"!=a.getStyle("height")?p(a.getStyle("height"),"y"):f.y-100;if(b||!1!==d.options.fullSize)return{width:c,height:g};var m=Math.min(Math.min(f.x-50,c)/c,Math.min(f.y-100,g)/g);return{width:Math.round(m*
c),height:Math.round(m*g)}},sizeStringToInt:function(a,b){return p(a,b)}});return t}(m);Element.implement({cerabox:function(a){return this.store("cerabox",new CeraBox(this,a))}});Elements.implement({cerabox:function(a){if(a&&"null"!=typeOf(a.group)&&!0!==a.group)this.each(function(c){c.store("cerabox",new CeraBox(c,a))});else{var c=new CeraBox(this,a);this.each(function(a){a.store("cerabox",c)})}return this}})})(window);
